{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *\n",
    "from sympy.abc import *\n",
    "# import math as m\n",
    "import handcalcs.render"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$计算\\int_{0}^{\\frac{\\pi}{2} }\\sin (x) dx $"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "limit((tan(pi/(2**(n+2)))/((tan(pi/(2**(n+1)))))),n,oo)\n",
    "x_1=diff(tan(pi/(2**(n+2))),n)\n",
    "x_2=diff(tan(pi/(2**(n+1))),n)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\[\n",
       "\\begin{aligned}\n",
       "y_{1} &= \\left( - \\left( 2 \\right) ^{ \\left( \\left( - n \\right) - 2 \\right) } \\right) \\cdot \\pi \\cdot \\left( \\left( \\tan \\left( \\left( 2 \\right) ^{ \\left( \\left( - n \\right) - 2 \\right) } \\cdot \\pi \\right) \\right) ^{ 2 } + 1 \\right) \\cdot \\ln \\left( 2 \\right) \\\\&= \\left( - \\left( 2 \\right) ^{ \\left( \\left( - \\displaystyle n \\right) - 2 \\right) } \\right) \\cdot \\displaystyle \\pi \\cdot \\left( \\left( \\tan \\left( \\left( 2 \\right) ^{ \\left( \\left( - \\displaystyle n \\right) - 2 \\right) } \\cdot \\displaystyle \\pi \\right) \\right) ^{ 2 } + 1 \\right) \\cdot \\ln \\left( 2 \\right) \\\\&= \\displaystyle - 2^{- n - 2} \\pi \\left(\\tan^{2}{\\left(2^{- n - 2} \\pi \\right)} + 1\\right) \\log{\\left(2 \\right)}  \\\\\n",
       "\\\\[10pt]\n",
       "y_{2} &= \\left( - \\left( 2 \\right) ^{ \\left( \\left( - n \\right) - 1 \\right) } \\right) \\cdot \\pi \\cdot \\left( \\left( \\tan \\left( \\left( 2 \\right) ^{ \\left( \\left( - n \\right) - 1 \\right) } \\cdot \\pi \\right) \\right) ^{ 2 } + 1 \\right) \\cdot \\ln \\left( 2 \\right) \\\\&= \\left( - \\left( 2 \\right) ^{ \\left( \\left( - \\displaystyle n \\right) - 1 \\right) } \\right) \\cdot \\displaystyle \\pi \\cdot \\left( \\left( \\tan \\left( \\left( 2 \\right) ^{ \\left( \\left( - \\displaystyle n \\right) - 1 \\right) } \\cdot \\displaystyle \\pi \\right) \\right) ^{ 2 } + 1 \\right) \\cdot \\ln \\left( 2 \\right) \\\\&= \\displaystyle - 2^{- n - 1} \\pi \\left(\\tan^{2}{\\left(2^{- n - 1} \\pi \\right)} + 1\\right) \\log{\\left(2 \\right)}  \\\\\n",
       "\\\\[10pt]\n",
       "c &= \\displaystyle \\frac{2^{- n - 2} \\cdot 2^{n + 1} \\left(\\tan^{2}{\\left(2^{- n - 2} \\pi \\right)} + 1\\right)}{\\tan^{2}{\\left(2^{- n - 1} \\pi \\right)} + 1} \\; \n",
       "\\\\[10pt]\n",
       "d &= \\displaystyle 0.5 \\; \n",
       "\\\\[10pt]\n",
       "w &= \\displaystyle \\tan^{2}{\\left(x \\right)} + 1 \\; \n",
       "\\end{aligned}\n",
       "\\]"
      ],
      "text/plain": [
       "<IPython.core.display.Latex object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%render sympy\n",
    "y_1=x_1\n",
    "y_2=x_2\n",
    "c=y_1/y_2\n",
    "d=limit(c,n,oo)\n",
    "w=diff(tan(x),x)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "05a237592cd1f1c47d6da52b1c9e9cb4b6d7e67883224033955e685c2762c5fd"
  },
  "kernelspec": {
   "display_name": "Python 3.9.10 64-bit (windows store)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
